<script lang="ts" setup name="admin-role-tree">
import { rIndexPrivileges, userAuthInfo } from '@fl/api/iam-api'

const authList = ref([])
const privileges = ref([])

function getUserAuthInfo() {
    userAuthInfo().then((res) => {
        console.log(res, 'resssssssssssssss')
        getRIndexPrivileges(res.org_id)
    })
}
getUserAuthInfo()
async function getRIndexPrivileges(data) {
    const params = {
        org_id: data,
    }
    rIndexPrivileges(params).then((res) => {
        console.log(res, '权限列表')
        res.forEach(((item: any) => {
            authList.value.push(item.code)
        }))
        console.log(authList, 'authListauthListauthList')
    })
}
</script>

<template>
    <el-checkbox-group v-for="(item, index) in authList"
                       :key="index"
                       v-model="privileges"
                       privileges
    >
        <el-checkbox :value="item"
                     :label="item"
        >
            {{ item }}
        </el-checkbox>
    </el-checkbox-group>
</template>
